package com.zz.Interface.studentMannger;

import java.util.ArrayList;

public class Operator1 implements StudentOperator {
    @Override
    public void printAllInfo(ArrayList<Student> students) {
        System.out.println("===============");
        for(int i = 0; i < students.size(); i++){
            Student student = students.get(i);
            System.out.println("学生的姓名：" + student.getName() + "性别："
                    + student.getSex() + "成绩" + student.getScore());
        }
    }

    @Override
    public void printAverageScore(ArrayList<Student> students) {
        double scoreAll = 0.0;
        System.out.println("===============");
        for(int i = 0; i < students.size(); i++){
            Student student = students.get(i);
            scoreAll += student.getScore();
        }
        double average = scoreAll/students.size();
        System.out.println("全班平均成绩是：" + average);
    }
}
